import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { MessageFileInterfixVO, MessageFileInterfixForm, MessageFileInterfixQuery } from '@/leadmall/api/messageFileInterfix/types';

/**
 * 查询消息关联的附件列表
 * @param query
 * @returns {*}
 */

export const listMessageFileInterfix = (query?: MessageFileInterfixQuery): AxiosPromise<MessageFileInterfixVO[]> => {
  return request({
    url: PORT +'/leadmall/messageFileInterfix/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询消息关联的附件详细
 * @param id
 */
export const getMessageFileInterfix = (id: string | number): AxiosPromise<MessageFileInterfixVO> => {
  return request({
    url: PORT +'/leadmall/messageFileInterfix/' + id,
    method: 'get'
  });
};

/**
 * 新增消息关联的附件
 * @param data
 */
export const addMessageFileInterfix = (data: MessageFileInterfixForm) => {
  return request({
    url: PORT +'/leadmall/messageFileInterfix',
    method: 'post',
    data: data
  });
};

/**
 * 修改消息关联的附件
 * @param data
 */
export const updateMessageFileInterfix = (data: MessageFileInterfixForm) => {
  return request({
    url: PORT +'/leadmall/messageFileInterfix',
    method: 'put',
    data: data
  });
};

/**
 * 删除消息关联的附件
 * @param id
 */
export const delMessageFileInterfix = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/messageFileInterfix/' + id,
    method: 'delete'
  });
};
